home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc Source Code / Imaging / PolygonClipper / PGEvent.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-22  |  2.1 KB  |  97 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        PGEvent.h
  3.  
  4.     Contains:    Geometric event structure for the clipper.
  5.  
  6.     Owned by:    Jens Alfke (based on algorithm by A. C. Kilgour)
  7.  
  8.     Copyright:    © 1994 - 1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.     
  12.          <3>     3/22/95    jpa        Added aet param to MergeWith [1230776]
  13.          <2>     6/30/94    jpa        Added dummy destructor for PGEvent to
  14.                                     appease CodeWarrior compiler.
  15.          <1>     6/15/94    jpa        first checked in
  16.          ---------------------------Moved to ODSOM project.
  17.          <1>      5/9/94    jpa        first checked in
  18.     
  19.     In Progress:
  20.         
  21. */
  22.  
  23. #ifndef _PGEVENT_
  24. #define _PGEVENT_
  25.  
  26. #ifndef _ALTPOINT_
  27. #include "AltPoint.h"
  28. #endif
  29.  
  30. #ifndef _ODTYPES_
  31. #include "ODTypes.h"
  32. #endif
  33.  
  34. #ifndef _PRIORTYQ_
  35. #include "PriortyQ.h"
  36. #endif
  37.  
  38. #ifndef _PGCOMMON_
  39. #include "PGCommon.h"
  40. #endif
  41.  
  42. #ifndef _PGEDGE_
  43. #include "PGEdge.h"
  44. #endif
  45.  
  46.  
  47. class PGContour;
  48. class PGEdge;
  49. class PGEdgeTable;
  50. class PGVertex;
  51. class PGEventQueue;
  52.  
  53.  
  54. class PGEvent :public Sortable, public ODPoint
  55. {
  56.     public:
  57.     
  58.         PGEvent( );
  59.         ~PGEvent( )        { }                    // Keeps CodeWarrior happy
  60.         PGEvent*    InitLocalMinEvent( const PGVertex* );
  61.         PGEvent*    InitLowEvent( const PGEdge* );
  62.         PGEvent*    InitIntersection( const PGEdge*, const PGEdge*,
  63.                                         const ODPoint § );
  64.     
  65.         virtual ODBoolean ComesBefore( const Sortable* ) const;        // From Sortable class
  66.         
  67.         void        MergeWith( PGEvent*, PGEdgeTable &aet );
  68.         void        Process( PGEdgeTable&, PGEventQueue& );
  69.     
  70.     protected:
  71.         void        ConnectEdgePaths( PGEdgeTable &upperEdges );
  72.         void        ConnectAdjacentEdgePaths( PGEdgeTable &upperEdges, PGSense firstSense );    
  73.     
  74.         PGEdge*        fFirstUpperEdge;        // 1st edge (in AET) of my upper-edge range
  75.         PGEdge*        fLastUpperEdge;            // Last edge of upper-edge range
  76.         PGEdgeTable    fLowerEdges;            // List of lower edges
  77. };
  78.  
  79.  
  80. class PGEventQueue :private PriorityQueue
  81. {
  82.     public:
  83.         PGEventQueue( ODULong suggestedSize )
  84.             :PriorityQueue(suggestedSize)
  85.             { }
  86.  
  87.         PriorityQueue::IsEmpty;
  88.         PriorityQueue::Add;
  89.         
  90.         void        AddIntersectionIfBelow( PGEdge*, PGEdge*, const PGEvent *curEv );
  91.         
  92.         PGEvent*    First( )    const    {return (PGEvent*)PriorityQueue::GetFirst();}
  93.         PGEvent*    RmvFirst( )            {return (PGEvent*)PriorityQueue::RemoveFirst();}
  94. };
  95.  
  96. #endif /*_PGEVENT_*/
  97.